﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SAPbouiCOM;

namespace BoAddonBiz_FreightForwarder
{
    class B1Form_SurverResult : SAPBoAddon.B1Form
    {


        Matrix mtx_fct1;
        DBDataSource dbds_SurverResult;

        //Matrix mtx_fct2;
        //DBDataSource dbds_SurverResult2;

        protected override bool BeforeSaveCheckFormData()
        {
            #region 判断
            //流水号
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;

            if (this.IsSerialNumNull())
            {
                #region 注释


                //string SerialNum = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "23").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //{
                //    SBOApp.StatusBar.SetText(SerialNum + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //}
                //else
                //{
                //    SBOApp.StatusBar.SetText(SerialNum + "IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //}
                #endregion
                ShowMessageInformation("23");
                return false;
            }

            //客户编号
            if (this.IsCardCodeNull())
            {

                #region 注释


                //string CardCode = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "1000004").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(CardCode + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(CardCode + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                #endregion
                ShowMessageInformation("1000004");
                return false;
            }

            //客户名称
            if (this.IsCardNameNull())
            {
                #region 注释


                //string CardName = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "16").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(CardName + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(CardName + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                #endregion
                ShowMessageInformation("16");
                return false;
            }

            //电话
            if (this.IsPhoneNull())
            {

                #region 注释


                //string Phone = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "15").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(Phone + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(Phone + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                #endregion
                ShowMessageInformation("15");

                return false;
            }

            //被访日期
            if (this.IsReadDateNull())
            {

                #region 注释


                //string ReadDate = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "21").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(ReadDate + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(ReadDate + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                #endregion
                ShowMessageInformation("21");
                return false;
            }

            //方案编号
            if (this.IsSurProcodeNull())
            {

                #region 注释


                //string SurProcode = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "37").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(SurProcode + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(SurProcode + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                #endregion
                ShowMessageInformation("37");
                return false;
            }

            //方案名称
            if (this.IsSurProNameNull())
            {

                #region 注释


                //string SurProName = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "12").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(SurProName + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(SurProName + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                #endregion
                ShowMessageInformation("12");
                return false;
            }

            //过账日期
            if (this.IsDocDateNull())
            {

                #region 注释


                //string DocDate = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "26").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(DocDate + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(DocDate + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);



                #endregion

                ShowMessageInformation("26");
                return false;
            }

            //到期日
            if (this.IsDocDueDateNull())
            {


                #region 注释


                //string DocDueDate = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "24").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(DocDueDate + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(DocDueDate + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);



                #endregion
                ShowMessageInformation("24");
                return false;
            }

            //凭证日期
            if (this.IsTaxDateNull())
            {


                #region 注释


                //string TaxDate = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "25").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(TaxDate + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(TaxDate + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);




                #endregion
                ShowMessageInformation("25");
                return false;
            }

            //调查日期
            if (this.IsSureryDateNull())
            {

                #region 注释


                //string SureryDate = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "31").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(SureryDate + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(SureryDate + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);




                #endregion
                ShowMessageInformation("31");
                return false;
            }


            //参考一
            if (this.IsReferenceResourcesOneNull())
            {


                #region 注释


                //string ReferenceResourcesOne = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "1000010").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(ReferenceResourcesOne + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(ReferenceResourcesOne + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);



                #endregion
                ShowMessageInformation("1000010");
                return false;
            }

            //参考二
            if (this.IsReferenceResourcesTwoNull())
            {

                #region 注释


                //string ReferenceResourcesTwo = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "1000009").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(ReferenceResourcesTwo + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(ReferenceResourcesTwo + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);

                #endregion
                ShowMessageInformation("1000009");
                return false;
            }

            //填表人
            if (this.IsCntctCodeNull())
            {

                #region 注释
                //string CntctCode = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "1000002").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(CntctCode + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(CntctCode + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);

                #endregion
                ShowMessageInformation("1000002");
                return false;
            }

            //备注
            if (this.IsRemarksNull())
            {

                #region 注释
                //string Remarks = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "11").ToString();
                //if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                //    SBOApp.StatusBar.SetText(Remarks + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                //else
                //    SBOApp.StatusBar.SetText(Remarks + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                #endregion

                ShowMessageInformation("11");
                return false;
            }


            //判断 Matrix
            return CheckMatrix();


            #endregion
        }


        public B1Form_SurverResult()
        {
            frm_ItemEvent += new SAPBoAddon.IB1FormEvents.B1ItemEventEventHandler(B1Form_SurverResult_frm_ItemEvent);
            frm_MenuEvent += new SAPBoAddon.IB1FormEvents.B1MenuEventEventHandler(B1Form_SurverResult_frm_MenuEvent);
        }

        void B1Form_SurverResult_frm_MenuEvent(SAPBoAddon.B1AddonBase.B1MenuEvent pVal, ref bool BubbleEvent)
        {

        }

        void B1Form_SurverResult_frm_ItemEvent(SAPBoAddon.B1AddonBase.B1ItemEvent pVal, ref bool BubbleEvent)
        {
            if (pVal.BeforeAction)
            {
                if (pVal.ItemUID == "mtx_0" && pVal.EventType == BoEventTypes.et_ITEM_PRESSED)
                {
                    if (pVal.FormMode == 1 && pVal.ColUID == "V_11" && pVal.Row == mtx_fct1.RowCount + 1)
                    {
                        SAPBoAddon.B1Assistant.Matrix.AutoAddNewLine(this.CurrentForm, pVal.ItemUID, "col_f", "@AVA_QS_QSR1", pVal.Row);
                        mtx_fct1.SetCellFocus(pVal.Row + 1, 2);
                        BubbleEvent = false;
                    }

                }
                //if (pVal.ItemUID == "mtx_1" && pVal.EventType == BoEventTypes.et_ITEM_PRESSED)
                //{
                //    if (pVal.FormMode == 1 && pVal.ColUID == "V_11" && pVal.Row == mtx_fct1.RowCount + 1)
                //    {
                //        SAPBoAddon.B1Assistant.Matrix.AutoAddNewLine(this.CurrentForm, pVal.ItemUID, "col_f", "@AVA_QS_QSR1", pVal.Row);
                //        mtx_fct1.SetCellFocus(pVal.Row + 1, 2);
                //        BubbleEvent = false;
                //    }
                //}

            }
        }

        protected override void FormEditModeChange(SAPBoAddon.frmItemEditMode frmEditMode)
        {
            switch (frmEditMode)
            {
                case SAPBoAddon.frmItemEditMode.fe_AddMode:
                    this.Matrix_AutoAddLine();
                    break;
            }
        }

        protected override void FormInfoSetting(SAPBoAddon.B1FormSetting FormSetting)
        {
            //FormSetting.FormType = B1FormTypes.ado_AVA_QS_SurveyResult;
            //FormSetting.FormFileName = B1FormTypes.ado_AVA_QS_SurveyResult.ToString() + "Form.srf";


            FormSetting.AutoGetObjectNextNumber = true;
            FormSetting.MatrixSetting.MtxUID = "mtx_0";
            FormSetting.MatrixSetting.AutoAddNewLine = true;
            FormSetting.MatrixSetting.AutoLineKeyCol = "V_11";
            FormSetting.MatrixSetting.BeforeSaveDeleteNoValueLine = true;
            FormSetting.MatrixSetting.BeforeSaveFixDbDataSourceData = false;
            FormSetting.MatrixSetting.TableKeyField = "LineId";
            FormSetting.MatrixSetting.TableVisOrder = "VisOrder";
            FormSetting.MatrixSetting.PrimaryLineCol = "col_f";
            FormSetting.MatrixSetting.TableName = "@AVA_QS_QSR1";
            FormSetting.MatrixSetting.Add();


            //FormSetting.AutoGetObjectNextNumber = true;
            //FormSetting.MatrixSetting.MtxUID = "mtx_1";
            //FormSetting.MatrixSetting.AutoAddNewLine = true;
            //FormSetting.MatrixSetting.AutoLineKeyCol = "V_11";
            //FormSetting.MatrixSetting.BeforeSaveDeleteNoValueLine = true;
            //FormSetting.MatrixSetting.BeforeSaveFixDbDataSourceData = false;
            //FormSetting.MatrixSetting.TableKeyField = "LineId";
            //FormSetting.MatrixSetting.TableVisOrder = "VisOrder";
            //FormSetting.MatrixSetting.PrimaryLineCol = "col_f";
            //FormSetting.MatrixSetting.TableName = "@AVA_QS_QSR1";
            //FormSetting.MatrixSetting.Add();
        }

        protected override void InitializeForm(SAPBoAddon.B1FormInitializePar InitPar)
        {


            mtx_fct1 = this.CurrentForm.Items.Item("mtx_0").Specific as Matrix;
            dbds_SurverResult = this.CurrentForm.DataSources.DBDataSources.Item("@AVA_QS_QSR1");
        }



        /// <summary>
        /// 判断流水号是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsSerialNumNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string SerialNum = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "28").ToString();
            if (SerialNum.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断客户编码是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsCardCodeNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string CardCode = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "35").ToString();
            if (CardCode.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断客户名称是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsCardNameNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string CardName = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "34").ToString();
            if (CardName.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断电话是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsPhoneNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string Phone = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "19").ToString();
            if (Phone.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断被访日期是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsReadDateNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string ReadDate = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "22").ToString();
            if (ReadDate.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }

        /// <summary>
        /// 判断方案编号是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsSurProcodeNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string SurProcode = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "38").ToString();
            if (SurProcode.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断方案名称是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsSurProNameNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string SurProName = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "33").ToString();
            if (SurProName.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断过账日期是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsDocDateNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string DocDate = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "27").ToString();
            if (DocDate.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断到期日是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsDocDueDateNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string DocDueDate = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "1000005").ToString();
            if (DocDueDate.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断凭证日期是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsTaxDateNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string TaxDate = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "29").ToString();
            if (TaxDate.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断调查日期为空
        /// </summary>
        /// <returns></returns>
        private bool IsSureryDateNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string SureryDate = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "32").ToString();
            if (SureryDate.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断参考一是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsReferenceResourcesOneNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string ReferenceResourcesOne = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "36").ToString();
            if (ReferenceResourcesOne.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断参考二是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsReferenceResourcesTwoNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string ReferenceResourcesTwo = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "1000011").ToString();
            if (ReferenceResourcesTwo.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断填写人是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsCntctCodeNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string CntctCode = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "1000003").ToString();
            if (CntctCode.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }
        /// <summary>
        /// 判断问卷调查结果是否为空
        /// </summary>
        /// <returns></returns>
        private bool IsRemarksNull()
        {
            bool RetVal = false;
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string Remarks = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "1000007").ToString();
            if (Remarks.Trim().Length == 0)
            {
                RetVal = true;
            }
            return RetVal;
        }


        //判断Matrix
        private bool CheckMatrix()
        {
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            SAPbouiCOM.Matrix oMtx;
            SAPbouiCOM.Matrix oMtx2;
            //SAPbouiCOM.DBDataSource oDbds = null;

            //oDbds = oFrom.DataSources.DBDataSources.Item("@AVA_QS_QSR1");
            //题目信息
            oMtx = oFrom.Items.Item("1000001").Specific;
            oMtx2 = oFrom.Items.Item("7").Specific;
            if (oMtx.RowCount == 0)
            {
                string title = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "6").ToString();
                if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                    SBOApp.StatusBar.SetText(title + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                else
                    SBOApp.StatusBar.SetText(title + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                return false;
            }

            if (oMtx2.RowCount == 0)
            {
                string title = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, "5").ToString();
                if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                    SBOApp.StatusBar.SetText(title + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                else
                    SBOApp.StatusBar.SetText(title + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                return false;
            }


            for (int i = 1; i <= oMtx.RowCount; i++)
            {
                string QuestionsCode = oMtx.Columns.Item("V_1").Cells.Item(i).Specific.Value.ToString();
                string Questions = oMtx.Columns.Item("V_2").Cells.Item(i).Specific.Value.ToString();
                string Remarks = oMtx.Columns.Item("V_0").Cells.Item(i).Specific.Value.ToString();
                if (QuestionsCode.Trim().Length == 0)
                {
                    if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                        SBOApp.StatusBar.SetText("题目编码不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    else
                        SBOApp.StatusBar.SetText("QuestionsCode IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    return false;
                }

                if (Questions.Trim().Length == 0)
                {
                    if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                        SBOApp.StatusBar.SetText("题目不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    else
                        SBOApp.StatusBar.SetText("Questions IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    return false;
                }

                if (Remarks.Trim().Length == 0)
                {
                    if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                        SBOApp.StatusBar.SetText("备注不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    else
                        SBOApp.StatusBar.SetText("Remarks IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    return false;
                }
            }


            for (int i = 1; i <= oMtx2.RowCount; i++)
            {
                string ResultsCode = oMtx2.Columns.Item("V_2").Cells.Item(i).Specific.Value.ToString();
                string Results = oMtx2.Columns.Item("V_3").Cells.Item(i).Specific.Value.ToString();

                if (ResultsCode.Trim().Length == 0)
                {
                    if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                        SBOApp.StatusBar.SetText("调查结果选项编码不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    else
                        SBOApp.StatusBar.SetText("ResultsCode IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    return false;
                }
                if (Results.Trim().Length == 0)
                {
                    if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                        SBOApp.StatusBar.SetText("调查结果选项内容不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    else
                        SBOApp.StatusBar.SetText("Results IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    return false;
                }
            }

            #region 注释
            //for (int i = 0; i <= oDbds.Size - 1; i++)
            //{
            //    string QuestionsCode = oDbds.GetValue("U_QuestionsCode", i);
            //    string Questions = oDbds.GetValue("U_Questions", i);
            //    string Remarks = oDbds.GetValue("U_Remarks", i);
            //    string ResultsCode = oDbds.GetValue("U_ResultsCode", i);
            //    string Results = oDbds.GetValue("U_Results", i);
            //    if (QuestionsCode.Trim().Length == 0)
            //    {
            //        if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
            //            SBOApp.StatusBar.SetText("题目编码不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            //        else
            //            SBOApp.StatusBar.SetText("QuestionsCode IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            //        return false;
            //    }

            //    if (Questions.Trim().Length == 0)
            //    {
            //        if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
            //            SBOApp.StatusBar.SetText("题目不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            //        else
            //            SBOApp.StatusBar.SetText("Questions IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            //        return false;
            //    }

            //    if (Remarks.Trim().Length == 0)
            //    {
            //        if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
            //            SBOApp.StatusBar.SetText("备注不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            //        else
            //            SBOApp.StatusBar.SetText("Remarks IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            //        return false;
            //    }

            //    if (ResultsCode.Trim().Length == 0)
            //    {
            //        if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
            //            SBOApp.StatusBar.SetText("调查结果选项编码不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            //        else
            //            SBOApp.StatusBar.SetText("ResultsCode IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            //        return false;
            //    }
            //    if (Results.Trim().Length == 0)
            //    {
            //        if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
            //            SBOApp.StatusBar.SetText("调查结果选项内容不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            //        else
            //            SBOApp.StatusBar.SetText("Results IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            //        return false;
            //    }

            //}
            #endregion


            return true;


        }


        /// <summary>
        /// 显示中文信息还是英文提示信息
        /// </summary>
        /// <param name="UItemId"></param>
        private void ShowMessageInformation(string UItemId)
        {
            SAPbouiCOM.Form oFrom;
            oFrom = this.CurrentForm;
            string information = SAPBoAddon.B1Assistant.Item.GetValue(oFrom, UItemId).ToString();
            if (SBOCompany.language.ToString().Trim().Contains("Chinese"))
                SBOApp.StatusBar.SetText(information + "不能为空！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            else
                SBOApp.StatusBar.SetText(information + " IS NOT NULL！", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
        }

    }
}
